<?php

class LoginController extends Controller {
	public $DB;
	public function __Init(){
		$this->DB = new LoginModel;
	}

	public function login(){
		if(ISPOST){
			if(empty($_POST['account'])){
				$this->error('用户名不能为空',__MODEL__.'&c=Login&a=login');
				return false;
			}
			if(empty($_POST['password'])){
				$this->error('密码不能为空',__MODEL__.'&c=Login&a=login');
				return false;
			}
			if($this->DB->checkLogin()){
				header('Location: ?m=Admin&c=Index&a=index');
				return true;
			}else{
				$this->error($this->DB->error,__MODEL__.'&c=Login&a=login');
				return false;
			}
		}else{
			$this->display('login.html');
		}
	}
}

?>